//
//  SPEntry.h
//  Sophie
//
//  Created by Anton Chebotaev on 4/10/09.
//  Copyright 2009 IFMO. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <LJClientKit/LJClientKit.h>
#import <WebKit/WebKit.h>

#import "SPAccountController.h"
#import "SPTaggedTextView.h"
#import "SPTagsManager.h"
#import "SPUserpicsPopUpButton.h"
#import "SPAppDelegate.h"

@interface SPEntryController : NSDocument {
	LJEntry *entry;
	NSView *previousView;
	
#pragma mark Interface helpers
	NSMenu *journalsMenu;
	NSMenu *userpicsMenu;
	NSMenu *securityMenu;	
		
#pragma mark Outlets
	IBOutlet NSWindow *entryWindow;
	IBOutlet SPTagsManager *tagsManager;
	IBOutlet NSDrawer *drawer;
	BOOL drawerOpened;

	IBOutlet NSWindow *progressWindow;
	IBOutlet NSProgressIndicator *progressIndicator;
	IBOutlet NSTextField *progressTextField;
	IBOutlet NSTableView *tagsTableView;
	
#pragma mark Outlets - Toolbar
	IBOutlet NSToolbarItem *postEntryButton;
	IBOutlet NSPopUpButton *journalButton;
	IBOutlet NSPopUpButton *securityButton;

#pragma mark Outlets - Change View Button and Views
	IBOutlet NSSegmentedControl *viewModeSegmentedControl;
	IBOutlet WebView *previewWebView;
	IBOutlet NSTextField *subjectTextField;
	IBOutlet SPTaggedTextView *contentTextView;		

#pragma mark Outlets - Info panel	
	IBOutlet NSTextField *currentMusicTextField;
	IBOutlet NSComboBox *currentMoodComboBox;
	IBOutlet NSComboBox *locationComboBox;
	IBOutlet NSTokenField *tagsTokenField;
	IBOutlet NSDatePicker *backdatedDatePicker;

	IBOutlet NSImageView *userpicImageView;
	IBOutlet SPUserpicsPopUpButton *userpicsButton;
	IBOutlet NSButton *backdatedButton;
}

@property (readwrite, retain) LJEntry *entry;
@property (readwrite, retain) NSMenu *journalsMenu;
@property (readwrite, retain) NSMenu *userpicsMenu;
@property (readwrite, retain) NSMenu *securityMenu;

#pragma mark IBAction

- (IBAction)testAction:(id)sender;
- (IBAction)postEntry:(id)sender;
- (IBAction)toggleInfoDrawer:(id)sender;
- (IBAction)detectCurrentMusic:(id)sender;
- (IBAction)selectViewMode:(id)sender;

- (IBAction)changeSubject:(id)sender;
- (IBAction)changeContent:(id)sender;
- (IBAction)changeJournal:(id)sender;
- (IBAction)changeSecurity:(id)sender;
- (IBAction)changeUserpic:(id)sender;
- (IBAction)changeCurrentMusic:(id)sender;
- (IBAction)changeCurrentMood:(id)sender;
- (IBAction)changeLocation:(id)sender;
- (IBAction)changeTags:(id)sender;
- (IBAction)changeBackdatedState:(id)sender;
- (IBAction)changeBackdatedDate:(id)sender;

@end
